package com.rms.web;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.rms.domain.Job;
import com.rms.service.WorkerService;
import com.rms.service.impl.WorkerServiceImpl;

/**
 * 带数据(jobList)转发至work_main.jsp
 */
@WebServlet("/ToWorkMainPageServlet")
public class ToWorkMainPageServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	WorkerService workerService = new WorkerServiceImpl();

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		List<Job> jobList;
		jobList = workerService.getJobList();
		request.setAttribute("jobList", jobList);
		request.getRequestDispatcher("/worker_main.jsp").forward(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
